<script setup lang="ts">
import Refresh from '@iconify-icons/tabler/refresh'
import {XCollapseBtn} from '../XCollapseBtn'
import type {RefreshBtnPropsType} from './types'

defineOptions({
  name: 'XRefreshBtn',
})

withDefaults(defineProps<RefreshBtnPropsType>(), {
  iconProps: {} as any,
  text: '刷新',
  btnProps: {} as any,
  click: () => {
  },
  collapse: false,
  disabled: false,
  tooltipProps: {} as any
})

const slots = useSlots()
</script>

<template>
  <XCollapseBtn
    :icon-props="{
      iconProps: {
        icon: Refresh
      },
      ...iconProps
    }"
    :text="text"
    :btn-props="btnProps"
    :click="click"
    :collapse="collapse"
    :disabled="disabled"
    :tooltip-props="tooltipProps"
  >
    <template v-if="slots['btn-icon']" #btn-icon>
      <slot name="btn-icon"/>
    </template>
  </XCollapseBtn>
</template>

<style scoped lang="scss">

</style>
